package com.shanjupay.transaction.api;

import com.shanjupay.common.domain.BusinessException;
import com.shanjupay.transaction.api.dto.PayChannelDTO;
import com.shanjupay.transaction.api.dto.PayChannelParamDTO;
import com.shanjupay.transaction.api.dto.PlatformChannelDTO;

import java.util.List;

/**
 * 支付通道服务
 * @author lsy
 * @date 2020/05/11
 */
public interface PayChannelService {

    /**
     * 所有获取平台服务类型 前端进行展示
     * @return
     * @throws BusinessException
     */
    List<PlatformChannelDTO> queryPlatformChannel() throws BusinessException;

    /**
     * 为app绑定平台服务
     * @param appId 应用id
     * @param platformChannelCodes 平台服务类型列表
     * @throws BusinessException
     */
    void bindPlatformChannelForApp(String appId, String platformChannelCodes) throws BusinessException;

    /**
     * 应用是否已经绑定某个服务类型
     * @param appId 应用ID
     * @param platformChannel 服务类型
     * @return
     * @throws BusinessException
     */
    int queryAppBindPlatformChannel(String appId, String platformChannel) throws BusinessException;

    /**
     * 根据平台服务获取支付渠道列表
     * @param platformChannelCode
     * @return
     * @throws BusinessException
     */
    List<PayChannelDTO> queryPayChannelByPlatformChannel(String platformChannelCode) throws BusinessException;

    /**
     * 保存支付渠道参数
     * @param payChannelParam {@link PayChannelParamDTO}
     * @throws BusinessException
     */
    void savePayChannelParam(PayChannelParamDTO payChannelParam) throws BusinessException;

    /**
     * 通过指定应用服务类型下所包含的原始支付渠道参数列表
     * @param appId
     * @param platformChannel
     * @return {@link PayChannelParamDTO}
     * @throws BusinessException
     */
    List<PayChannelParamDTO> queryPayChannelParamByAppAndPlatform(String appId, String platformChannel) throws BusinessException;

    /**
     * 根据应用、服务类型和支付渠道的代码查询该支付渠道的参数配置信息
     * @param appId 应用ID
     * @param platformChannel 服务类型code
     * @param payChannel 支付渠道代码
     * @return {@link PayChannelParamDTO}
     * @throws BusinessException
     */
    PayChannelParamDTO queryParamByAppPlatformPayChannel(String appId, String platformChannel, String payChannel) throws BusinessException;
}
